﻿using UnityEngine;
using System.Collections;

public class Boss02Controller : MonoBehaviour 
{
    public GameObject[] activeBullet;

    public GameObject[] Bullets;

    public Transform[] transformBullets;

    public Collider[] colliderSub;

    private bool flag01, flag02, flagHead;

    private EnemyController enemyController;

    private float timeBullet01;

    private float timeBullet02;

    void Awake()
    {
        enemyController = GetComponent<EnemyController>();
    }

    void FixedUpdate()
    {

      


            if (activeBullet[0].active && !flag01)
            {
                Shoot(1 , 2, 0, 6);
                flag01 = true;
            }

            else if (!activeBullet[0].active)
            {
                flag01 = false;
            }


            if (activeBullet[1].active && !flag02)
            {
                Shoot(2 , 3, 0, 6);
                flag02 = true;
            }

            else if (!activeBullet[1].active)
            {
                flag02 = false;
            }
     

    }
    void Shoot(int index, int n, float minRandom, float maxRandom)
    {
        for (int i = index; i < n; i++)
        {
            int temp = (int)Random.Range(minRandom, maxRandom);
            Instantiate(Bullets[temp], transformBullets[i].position, Bullets[temp].transform.rotation);
        }
        //timeBullet01 = 0;
    }
  
}
